"use strict";
cc._RF.push(module, 'eea3bKDDDhD2aZBEdNuECY4', 'ViewBase');
// scripts/ViewBase.js

"use strict";

var e = require;
var t = module;
var n = exports;
Object.defineProperty(n, "__esModule", {
  value: !0
});
n.ViewAni = void 0;
var o,
    i = cc._decorator,
    a = i.ccclass,
    r = i.property;

(function (e) {
  e[e.none = 0] = "none";
  e[e.scale = 1] = "scale";
  e[e.alpha = 2] = "alpha";
  e[e.move = 3] = "move";
})(o = n.ViewAni || (n.ViewAni = {}));

var s = function (e) {
  __extends(t, e);

  function t() {
    var t = null !== e && e.apply(this, arguments) || this;
    t.scalePanel = null;
    t.closeCB = null;
    t.aniType = o.none;
    t.isEnter = !1;
    return t;
  }

  t.prototype.enter = function (e) {
    if (!this.isEnter) {
      this.isEnter = !0;
      this.closeCB = e;
      this.init();
      if (this.aniType == o.none) this.node.active = !0;else if (this.aniType == o.scale) {
        this.node.active = !0;
        this.scalePanel.setScale(.3);
        this.scalePanel.runAction(cc.scaleTo(.25, 1).easing(cc.easeBackOut()));
        this.node.runAction(cc.fadeIn(.4).easing(cc.easeCircleActionOut()));
      } else if (this.aniType == o.alpha) {
        this.node.opacity = 0;
        this.node.active = !0;
        this.node.runAction(cc.sequence(cc.delayTime(.3), cc.fadeIn(.4).easing(cc.easeCircleActionOut())));
      } else this.node.active = !0;
    }
  };

  t.prototype.init = function () {};

  t.prototype.exit = function (e) {
    if (this.isEnter) {
      this.isEnter = !1;
      e && (this.closeCB = e);
      var t = this;

      if (this.aniType == o.none) {
        if (this.closeCB) {
          this.closeCB();
          this.closeCB = null;
        }

        this.node.destroy();
      } else if (this.aniType == o.scale) {
        var n = cc.scaleTo(.2, .3).easing(cc.easeCircleActionOut()),
            i = cc.callFunc(function () {
          if (t.closeCB) {
            t.closeCB();
            t.closeCB = null;
          }

          t.node.destroy();
        }, this),
            a = cc.fadeOut(.2).easing(cc.easeCircleActionOut());
        this.node.runAction(a);
        this.scalePanel.runAction(cc.sequence(n, i));
      } else if (this.aniType == o.alpha) {
        n = cc.fadeOut(.2).easing(cc.easeCircleActionOut()), i = cc.callFunc(function () {
          if (t.closeCB) {
            t.closeCB();
            t.closeCB = null;
          }

          t.node.destroy();
        }, this);
        this.node.runAction(cc.sequence(n, i));
      } else {
        if (t.closeCB) {
          t.closeCB();
          t.closeCB = null;
        }

        this.node.destroy();
      }
    }
  };

  __decorate([r(cc.Node)], t.prototype, "scalePanel", void 0);

  __decorate([r({
    type: cc.Enum(o),
    displayName: "动画类型"
  })], t.prototype, "aniType", void 0);

  return __decorate([a], t);
}(cc.Component);

n["default"] = s;

cc._RF.pop();